//
//  MerchantHistoryCell.m
//  ZSYH
//
//  Created by 主事丫环HU on 2020/6/15.
//  Copyright © 2020 魏堰青. All rights reserved.
//

#import "MerchantHistoryCell.h"
@interface MerchantHistoryCell()
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UITextView *contentTextView;
@property (weak, nonatomic) IBOutlet UIImageView *lineImageView;
@end
@implementation MerchantHistoryCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.contentTextView setEditable:NO];
}
+ (instancetype)cellWithTableView:(UITableView *)tableView {
    
    static NSString *ID = @"MerchantHistoryCell";
    
    MerchantHistoryCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        
        cell = [NSBundle.mainBundle loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil].firstObject;
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
- (void)setModel:(NegotiationHistoryModel *)model{
    self.timeLabel.text = model.createTime;
    if ([model.state isEqualToString:@"-1"]){
        self.contentTextView.text = [NSString stringWithFormat:@"已驳回，请查看驳回原因\n驳回原因：%@",model.refuse];

    } else if ([model.state isEqualToString:@"1"]){
        self.contentTextView.text = [NSString stringWithFormat:@"请尽快回寄损坏产品,运费需要自行承担"];
    } else if ([model.state isEqualToString:@"2"]){
        self.contentTextView.text = [NSString stringWithFormat:@"已审核通过，暂未发放补助金。"];
    } else if ([model.state isEqualToString:@"5"]){
        self.contentTextView.text = [NSString stringWithFormat:@"补助金已发放。"];
    }
    if (model.isLast == YES) {
        self.lineImageView.hidden = YES;
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
